package com.party.web.web.controller.crowdfundMultiple;

import com.party.common.paging.Page;
import com.party.core.model.distributor.WithCount;
import com.party.web.biz.crowdfund.RepresentBizService;
import com.party.web.web.annotation.ControlParam;
import com.party.web.web.annotation.DataControl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @ClassName RepresentMultipleController
 * @Description 代言控制器
 * @Author yifeng
 * @Date 2019/3/25 10:31
 **/
@Controller
@RequestMapping("activityMultiple/represent")
public class RepresentMultipleController {
    @Autowired
    private RepresentBizService representBizService;

    /**
     * 联合发起列表
     *
     * @param id   活动编号
     * @param page 分页参数
     * @return 输出视图
     */
    @DataControl
    @RequestMapping(value = "listForActivity")
    public ModelAndView listForActivity(@ControlParam(table = "activity", column = "member") String id, WithCount withCount, Page page) {
        ModelAndView modelAndView = new ModelAndView("activity/zcRepresent");
        modelAndView.addObject("isMultiple", true);
        modelAndView.addAllObjects(representBizService.listForActivityCommon(page, withCount, id));
        return modelAndView;
    }

    /**
     * 根据事件查询联合发起数据
     *
     * @param withCount 查询参数
     * @param page      分页参数
     * @return 交互数据
     */
    @DataControl
    @RequestMapping(value = "listForEvent")
    public ModelAndView listForEvent(@ControlParam(table = "zc_event", column = "create_by", getMethodName = "getEventId") WithCount withCount, Page page) {
        ModelAndView modelAndView = new ModelAndView("crowdfund/representForEventList");
        modelAndView.addObject("isMultiple", true);
        modelAndView.addAllObjects(representBizService.listForEventCommon(page, withCount));
        return modelAndView;
    }
}